fix(polish): #305 工作日报场景"清晰结构"无效 + 内置 AI 工具词#318
Merged
Conversation
## 修 #305 polish.rs Structured prompt - 明确"已结构化 ≠ 不用改":原文是否已有标点 / 编号 / 换行不是判断依据; 照抄原结构 = 失败 - 重组阈值降到 ≥3 条;即使原文已经是 "1. 2. 3." 也要按主题重新归类成 双层 (a)(b) 子项,不能扁平照抄 - user_prompt 去掉"它不是问题,也不是任务"这条强 framing —— 旧措辞会 让 LLM 把书面化输入误判为"已整理好"直接 passthrough(issue #305 截图 根因) - 新增 # 示例 3:工作日报场景(已半结构化输入仍要重组)作为回归示例 ## 扩充 vocab-presets.json programmer 预设 追加 11 个 AI 工具名:Claude / Codex / Copilot / Cursor / Windsurf / Anthropic / OpenAI / GPT / ChatGPT / Gemini / DeepSeek。启用 programmer 预设后会同时注入 ASR 热词 bias + polish 提示词的 # 热词 段,覆盖 "cloud → Claude"这类同音误识别。 ## 测试 - polish.rs 新增 2 个 #305 回归测试: - structured_prompt_forces_regrouping_even_for_already_structured_input - user_prompt_no_longer_says_input_is_not_a_task - cargo test --lib polish: 10/10 passed - npx tsc --noEmit: clean Closes #305
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Summary
修 issue #305:工作日报场景下「清晰结构」mode 失效 —— LLM 消耗了 tokens 但输出与原文一致。同时把常用 AI 工具名加进 programmer 内置词库,覆盖「cloud → Claude」这类同音误识别。
根因(详见 #305 评论)
polish.rs中 Structured prompt 旧版只在「事项 ≥4 条」才强制归类,且对已编号 / 已分行的输入没有明确处理 → LLM 判定「已经整理好」直接 passthrough。user_prompt旧 framing「它不是问题,也不是任务」暗示输入是「待整理对象」,LLM 看到书面化输入就更倾向认为「不需要改」。改动
1.
polish.rsStructured prompt1. 2. 3.也要按主题重新归类成双层(a)(b)子项。user_prompt去掉「它不是问题,也不是任务」这条强 framing,改为指向 system prompt 的 mode 描述。2.
vocab-presets.jsonprogrammer 预设追加 11 个 AI 工具名:
Claude / Codex / Copilot / Cursor / Windsurf / Anthropic / OpenAI / GPT / ChatGPT / Gemini / DeepSeek。启用 programmer 预设后这些词会同时注入:
# 热词段 → polish 阶段在 ASR 听错时按正确写法输出(兜底)3. 回归测试(polish.rs)
structured_prompt_forces_regrouping_even_for_already_structured_input— 校验「已结构化 ≠ 不用改」、阈值 ≥3、工作日报示例存在user_prompt_no_longer_says_input_is_not_a_task— 校验旧 framing 已移除Test plan
cargo test --lib polish: 10/10 passed(含 2 个新加的 [area] 输出风格无效,LLM消耗了tokens并没有进行优化 #305 回归测试)npx tsc --noEmit: cleannode -e校验 vocab-presets.json 解析正常后续(独立 PR)
「可编辑的内置提示词模板系统」(用户可选 / 编辑 / 新建多套 polish 提示词模板,覆盖现有 4 个固定 mode)拆到下一个 PR:会涉及新类型
PromptTemplate、新持久化文件、IPC、Style.tsx 重做、prefs.default_mode迁移。本 PR 不涉及。Closes #305
PR Type
Bug fix, Enhancement
Description
Strengthen Structured mode prompt to prevent LLM from skipping reformatting of pre-structured input ([area] 输出风格无效,LLM消耗了tokens并没有进行优化 #305)
Lower threshold for forced regrouping from 4 to 3 items, requiring re-categorization even for numbered lists
Remove misleading "not a question or task" user prompt framing to align with system prompt directives
Expand programmer vocabulary preset with 11 AI tool names for better ASR recognition
Diagram Walkthrough
flowchart LR A["Structured Prompt Refactor"] --> C["Fix #305 passthrough"] B["Vocab Preset Expansion"] --> D["Improve ASR recognition"]File Walkthrough
polish.rs
Refactor Structured prompt to prevent passthroughopenless-all/app/src-tauri/src/polish.rs
pre-sorted and copying it is a failure
for already-numbered lists, and tighten single-paragraph rule to ≤2
items
diary example for semi-structured input
removes old framing
vocab-presets.json
Expand programmer vocab with AI tool namesopenless-all/app/src/lib/vocab-presets.json
Anthropic, OpenAI, GPT, ChatGPT, Gemini, DeepSeek) to programmer
preset for ASR hotword bias